package com.atguigu.gamll_sugar.service.impl;

import com.atguigu.gamll_sugar.entity.VisitorStats;
import com.atguigu.gamll_sugar.mapper.VisitorStatsMapper;
import com.atguigu.gamll_sugar.service.VisitorStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author chenlongStart
 * @create 2021-07-07 20:01
 * @desc
 */
@Service
public class VisitorStatsServiceImpl implements VisitorStatsService {

    @Autowired
    VisitorStatsMapper visitor;

    @Override
    public Map<String, VisitorStats> getVisitorGMV(int date) {
        List<VisitorStats> list = visitor.getVisitorGMV(date);
        Map<String, VisitorStats> result = new HashMap<>();
        for (VisitorStats visitorStats : list) {
            result.put(visitorStats.getHour(),visitorStats);
        }
        return result;
    }

    @Override
    public List<VisitorStats> statsByIsNew(int date) {
        return visitor.statsByIsNew(date);
    }
}
